package cn.wolfcode.web.service.impl;

import cn.wolfcode.web.domain.Employee;
import cn.wolfcode.web.mapper.EmployeeMapper;
import cn.wolfcode.web.service.IResetPasswordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;

@Service
public class ResetPasswordServiceImpl implements IResetPasswordService {


    @Autowired
    private EmployeeMapper employeeMapper;

    @Override
    public Employee resetePassword(Long id) {
        Employee employee = employeeMapper.selectByPrimaryKey(id);
        return employee;
    }

    @Override
    public void reset(String newPassword, Employee employee ) {


        employeeMapper.updateByPrimaryKey(employee);
    }
//    employeeMapper


  /*
    @Override
    public Employee selectPassword(String oldPassword, HttpSession session) {
        Employee employee = (Employee)session.getAttribute("employee");
        employee.getName();
        Employee selectByPasswordEmployee = employeeMapper.selectUsernameAndPassword(employee.getName(), oldPassword);
        if (selectByPasswordEmployee==null) {
            throw new RuntimeException("密码错误");
        }
        return selectByPasswordEmployee;
    }

    @Override
    public Employee ResetPassword( Employee employee) {

        return employeeMapper.resetPassword(employee);*/
}
